Skip to content

Reorganize repo into dirs + central run cmd#11

Merged
josefkarasek merged 1 commit into
kedify:mainfrom
josefkarasek:refactor
Jul 7, 2026
Merged

Reorganize repo into dirs + central run cmd#11
josefkarasek merged 1 commit into
kedify:mainfrom
josefkarasek:refactor

Conversation

@josefkarasek

Copy link
Copy Markdown
Contributor

Codex generated files were all in the same dir - adding new commands was getting difficult.

Copilot AI review requested due to automatic review settings July 7, 2026 09:48
@josefkarasek josefkarasek requested a review from a team as a code owner July 7, 2026 09:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reorganizes the CLI code into clearer subpackages (auth/get/list/apply) and introduces a shared Context plus service interfaces to centralize dependencies, making it easier to add and maintain commands as the repo grows.

Changes:

  • Split monolithic internal/cli command implementations into dedicated subpackages (auth, get, list, apply) while keeping a central internal/cli.Run entrypoint.
  • Introduce shared dependency contracts (internal/service) and a shared command runtime context (internal/cli/context.Context).
  • Restructure and expand tests to match the new package layout, replacing the previous all-in-one commands_test.go.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/service/credentials_store.go Adds a credentials storage interface and config-backed implementation for injection into commands.
internal/service/cluster.go Adds a cluster service interface for dependency injection.
internal/output/output.go Adds a small wrapper (WriteOutput) used as an injectable output function.
internal/errors/errors.go Introduces CommandResultError for returning exit code + structured payload from commands.
internal/cli/run.go Centralizes wiring of dependencies and routes commands to subpackages; handles CommandResultError output/exit codes.
internal/cli/recommendations.go Deleted; functionality moved into internal/cli/list/recommendations.go.
internal/cli/output.go Deleted; replaced by internal/output.WriteOutput wrapper for injection.
internal/cli/login.go Deleted; functionality moved into internal/cli/auth/login.go.
internal/cli/list/recommendations.go New list subcommand implementation using shared context + injected dependencies.
internal/cli/list/recommendations_test.go Adds targeted tests for listing recommendations.
internal/cli/list/clusters.go New list subcommand implementation using shared context + injected dependencies.
internal/cli/list/clusters_test.go Adds targeted tests for listing clusters.
internal/cli/list.go Deleted; functionality moved into internal/cli/list/clusters.go.
internal/cli/get/cluster.go Moves get-cluster command into get package and updates to use shared context.
internal/cli/get/cluster_test.go Adds targeted tests for get-cluster behaviors.
internal/cli/deps.go Deleted; replaced by internal/service/credentials_store.go and context wiring in run.go.
internal/cli/context/context.go New shared command context and shared token resolution helper.
internal/cli/context/context_test.go Adds tests for ResolveToken.
internal/cli/commands_test.go Deleted; replaced by package-scoped tests in new subpackages.
internal/cli/auth/token.go New auth token command implementation using shared context.
internal/cli/auth/token_test.go Adds tests for the auth token command.
internal/cli/auth/login.go New login command implementation using shared context and credentials store.
internal/cli/auth/login_test.go Adds tests for the login command.
internal/cli/auth.go Deleted; replaced by internal/cli/context.ResolveToken.
internal/cli/auth_token.go Deleted; functionality moved into internal/cli/auth/token.go.
internal/cli/apply/recommendations.go Moves apply-recommendations command into apply package and updates to use shared context + CommandResultError.
internal/cli/apply/recommendations_test.go Updates tests to call the command directly and to match new package-relative testdata paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/service/credentials_store.go
Comment thread internal/cli/list/clusters.go
Comment thread internal/cli/list/recommendations.go
@josefkarasek josefkarasek merged commit 8118e38 into kedify:main Jul 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants